;BELAJAR LCD
ORG 0h
call init_LCD
clr P3.6 
start: 	
	MOV R5, #1h
	MOV R4, #9h
	MOV R3, #9h
	CALL Convert_To_Desimal
	MOV B, #36d
	DIV AB
	MOV 10h, A
	MOV 11h, B
	MOV A, B
	PUSH ACC
	MOV A, 10H
	PUSH ACC
	MOV R1,#80h
	
	POP ACC
	mov DPTR,#DataBase36
	movc A,@A+DPTR
	call write_inst
	mov R1,A 
	call write_data

	POP ACC
	mov DPTR,#DataBase36
	movc A,@A+DPTR
	mov R1,#81h
	call write_inst
	mov R1,A 
	call write_data
stop: sjmp stop
Convert_To_Desimal:
	MOV A, R5
	MOV B, #100d
	MUL AB
	MOV R5, A
	MOV A, R4
	MOV B, #10d
	MUL AB
	ADD A,R5
	ADD A,R3
	RET
Init_lcd:  mov r1,#00000001b
	call write_inst
	mov r1,#00111000b
	call write_inst
	mov r1,#00001100b
	call write_inst
	mov r1,#00000110b
	call write_inst
	ret
;
Write_inst:
	clr P3.5
	mov P0,R1
	setb P3.7
	call delay
	clr P3.7
	ret

Write_data:
	setb P3.5
	mov P0,R1
	setb P3.7
	call delay
	clr p3.7
	ret

delay: mov R0,#01h 
delay1: mov R7,#0fh
djnz R0,delay1
ret

DataBase36:
	db '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
End
